/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 38917
 * Date: 2025-03-04
 * Time: 21:42
 */
class A{}
class B{}
class C{}

public class Main {
    public static void main(String[] args) {
        A a = new A();
        B b = new B();
        C c = new C();
        Thread thread1 = new Thread(()->{
            synchronized (a){
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
                synchronized (b) {
                    System.out.println("thread1线程");
                }
            }
        });
        Thread thread2 = new Thread(()->{
            synchronized (b){
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
                synchronized (c) {
                    System.out.println("thread2线程");
                }
            }
        });
        Thread thread3 = new Thread(()->{
            synchronized (b){
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
                synchronized (c) {
                    System.out.println("thread3线程");
                }
            }
        });
        thread1.start();
        thread2.start();
        thread3.start();

    }
}